package com.example.jeudupendu;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
	private Integer[] timg=new Integer[]{R.drawable.a,R.drawable.e,R.drawable.i,R.drawable.o,R.drawable.u,R.drawable.y,
			R.drawable.b,R.drawable.c,R.drawable.d,R.drawable.f,R.drawable.g,R.drawable.h,
			R.drawable.j,R.drawable.k,R.drawable.l,R.drawable.m,R.drawable.n,R.drawable.p,
			R.drawable.q,R.drawable.r,R.drawable.s,R.drawable.t,R.drawable.v,R.drawable.w,

			R.drawable.x,R.drawable.z};

	private Context mContext;
	public ImageAdapter(Context unContext){
		mContext = unContext;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return timg.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return timg[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView;
		if (convertView == null) {  
			imageView = new ImageView(mContext);
			imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
			imageView.setPadding(0, 0, 0, 0);
		} else {
			imageView = (ImageView) convertView;
		}
		imageView.setId(position);
		imageView.setImageResource(timg[position]);
		imageView.setVisibility(View.VISIBLE);
		return imageView;
	}

}
